package light.head.model.inv;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 商品调拨明细
 * @author yy
 *
 */
@Entity
@Table
public class InvAllocateItem implements Serializable{
	
	private static final long serialVersionUID = -1286221734378523182L;
	
	
	private Integer code;
	private Integer iac;				// 调拨编号
	private Integer cc;					// 商品编号
	private Integer count;				// 调拨数量
	private Double price;				// 调拨单价
	
	private String remark;				// 备注
	private Boolean deleted = false;	// 是否删除
	private Byte snc;					// 序列号状态 (1.没有序列号 2.一类序列号 3.唯一序列号)
	
	private String cname;
	
	private List<InvAllocateDetail> detailList;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getCc() {
		return cc;
	}
	@Column
	public String getRemark() {
		return remark;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Double getPrice() {
		return price;
	}
	@Column
	public Integer getIac() {
		return iac;
	}
	@Column
	public Integer getCount() {
		return count;
	}
	@Formula("(SELECT c.snc FROM InvCommodityItem c WHERE c.code = code)")
	public Byte getSnc() {
		return snc;
	}
	@Formula("(SELECT c.name FROM InvCommodityInfo c WHERE c.code IN (SELECT ci.cc FROM InvCommodityItem ci WHERE ci.code = cc))")
	public String getCname() {
		return cname;
	}
	
	@Transient
	public List<InvAllocateDetail> getDetailList() {
		return detailList;
	}
	
	
	
	
	

	

	public void setIac(Integer iac) {
		this.iac = iac;
	}
	public void setCount(Integer count) {
		this.count = count;
	}
	public void setCname(String cname) {
		this.cname = cname;
	}
	public void setDetailList(List<InvAllocateDetail> detailList) {
		this.detailList = detailList;
	}
	public void setSnc(Byte snc) {
		this.snc = snc;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setCc(Integer cc) {
		this.cc = cc;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	
	
}
